var redirectUrl = $('#redirectUrl').val();
console.log(redirectUrl);
$('.forgetPwd').on('tap',function(){
	location.href=MPJ.base+"/pages/forget-pwd.jsp";
})

$('.GreateAaccount').on('tap',function(){
	location.href=MPJ.base+"/pages/register/register-account.jsp?redirectUrl="+redirectUrl;
})
$('.form-group .vilidate').on('tap',function(){
	var date=new Date();
	$('.form-group .vilidate').html('<img src="http://203.189.170.43/mpj2/Captcha.jpg?'+date.getTime()+'" />');

})
$('.LogIn').on('tap',function(){
	var name=$('#email').val();
	var pwd=$('#password').val();
	var vildate=$('#vildate').val();

	var arr={
		hs_action_id:"login",
		hf_s_id:"WD11",
		hf_srv_id:"Zv_jcus_login",
		hs_usr_id:name,
		hs_passwd:pwd,
		hs_captcha:vildate,
		rand:4,
		url:encodeURI(apiUrl)
	};
	$.ajax({
		type: "get",
		url: MPJ.apiUrl + "",
		dataType: "text",
		async: false,
		data: arr,
		success: function (resultStr) {
			var result=JSON.parse(resultStr.substring(resultStr.indexOf('{'),resultStr.lastIndexOf('}')+1));
			if(result.bs_result==BS_RESULT.OK){
				MPJ.setIsLogin('Y');
				if( 'null' != redirectUrl){
					location.href=redirectUrl;
				}else {
					location.href=MPJ.base+"/pages/account/index.jsp";
				}
			}else{
				//重新加载验证码
				var date=new Date();
				$('.form-group .vilidate').html('<img src="http://203.189.170.43/mpj2/Captcha.jpg?'+date.getTime()+'" />');
				if(result.bs_err_code=="C0079"){
					$('.form-group').show();
				}else{
					$('.form-group').hide();
				}
				$('.error').show();
				$('.loginBox .error span').html(result.bs_message);
				mui('#offCanvasContentScroll').scroll().scrollTo(0,0,100);

			}
		},
		error:function(){

		}
	})
})